Microcontrollers are found in wide variety of products, such as electronic consumer devices and household appliances. A microcontroller should be clocked by a stable and accurate oscillating signal.
One method of generating a stable and accurate clock signal is to use a phase-locked loop (PLL) that receives an accurate reference signal from an external crystal oscillator. Manufacturing costs can be reduced, however, by generating the clock signal using an internal, on-chip oscillator as opposed to a more expensive external crystal oscillator.
An internal precision oscillator in a microcontroller can be an RC oscillator. A capacitor of the RC circuit is charged and discharged after the voltage across the capacitor reaches a lower and upper trigger voltage, respectively. The rate at which the capacitor is charged and discharged depends on the RC time constant of the RC circuit. The output frequency can be tuned by controlling either the capacitance of the capacitor and/or the resistance of the resistor in the RC circuit.
One way to perform this tuning is by means of digital control. A number in a register determines a set of capacitors that are switched in parallel, or a resistor configuration that has resistors in series, individual ones of which can be selectively short circuited.
At the end of production of a device, the oscillator is trimmed close to its target frequency by writing an appropriate number into the register. However, even though the frequency of the oscillator might meet the required target frequency perfectly after programming the register, the frequency might change over temperature and leave the allowed tolerance range.
In many applications, a microcontroller experiences a wide variation in its operating temperature. Temperature variation can affect the frequency of the clock signal output by the RC oscillator, and that clock signal may become insufficiently stable and not sufficiently accurate for the particular application. For example, the RC oscillator resistor resistance may change with temperature, i.e., the resistor has a positive or negative temperature coefficient. A change in resistance may affect not only the RC time constant, but also the trigger voltages at which the capacitor is charged and discharged.
In one example, an on-chip oscillator is desired that is capable to clock a CAN (controller area network) controller block. Such CAN controllers require that the clock frequency does not deviate more than a fixed percentage from its nominal frequency. The deviation value depends on the details of the bit-timing parameters, but in any case it is less than 2%, in some cases even less than 1%. Since no external clock reference is available, there is currently no design available that meets this requirement over an ambient temperature range from −40° C. up to +125° C.
One method of compensating for resistance changes caused by temperature variation in RC oscillators relies on matching resistors with positive temperature coefficients to resistors having negative temperature coefficients. Transistors and resistors may also be matched in a similar way to provide insensitivity to temperature variations. It can be difficult, however, to manufacture an on-chip resistor/transistor whose temperature coefficient inversely matches that of its paired resistor/transistor over the entire operating temperature range.
U.S. Pat. No. 7,176,765 discloses an implementation of temperature compensation by controlling a comparator bias current.
These known measures either require additional circuitry, such as temperature sensors and variable circuit elements, or they require components with very specific response characteristics to temperature, which may be difficult to manufacture.